﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SQLDataUploadHelper.models.domain
{
    internal class UploadServerConfig : INotifyPropertyChanged
    {
        private long idProperty = -1;
        private string urlProperty = "";
        private string userNameProperty = "";
        private string passwordProperty = "";

        /// <summary>
        /// 主键ID
        /// </summary>
        public long Id
        {
            get { return idProperty; }
            set
            {
                idProperty = value;
                NotifyPropertyChanged("Id");
            }
        }


        /// <summary>
        /// 上送地址
        /// </summary>
        public string Url
        {
            get { return urlProperty; }
            set
            {
                urlProperty = value;
                NotifyPropertyChanged("Url");
            }
        }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName
        {
            get { return userNameProperty; }
            set
            {
                userNameProperty = value;
                NotifyPropertyChanged("UserName");
            }
        }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password
        {
            get { return passwordProperty; }
            set
            {
                passwordProperty = value;
                NotifyPropertyChanged("Password");
            }
        }

        public void reset()
        {
            Id = -1;
            Url = String.Empty;
            UserName = String.Empty;
            Password = String.Empty;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
